javascript: what are immediate functions used for [duplicate]
Posted
by
tkoomzaaskz
on Stack Overflow
See other posts from Stack Overflow
or by tkoomzaaskz
Published on 2013-06-20T11:34:05Z
Indexed on
2013/06/27
10:21 UTC
Read the original article
Hit count: 164
JavaScript
|function
This question already has an answer here:
I've been programming in JS since some time, but I have never came upon a need of using immediate functions, for example:
(function(){
console.log('hello, I am an immediate function');
}())
What would be the difference if I just wrote:
console.log('hello, I am an immediate function');
? I don't have any access to this function anyway (it is not assigned anywhere). I think (but I'm not sure) that I can implement everything without immediate functions - so why do people use it?
© Stack Overflow or respective owner